home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / CD CHIP.ISO / WebServ / server7 / bin / ISAPISock.inc < prev    next >
Encoding:
Text File  |  1996-07-03  |  3.8 KB  |  129 lines

  1. Unit ISAPISock;
  2.  
  3. // Socket helper for ISAPI DLL's.
  4. // (C) 1996 Matt Taylor.
  5. // The source code ISAPISOCK.PAS is released to
  6. // the public domain.
  7.  
  8. // THIS Socket Lib uses server calls that are specific to ServerSeven.
  9. // It will not work with other WWW servers!!!
  10.  
  11. interface
  12.  
  13. uses
  14.   Windows, SysUtils, Classes, HTTPExt, Parser;
  15.  
  16. const
  17.   UNKNOWN_VARIABLE='UNKNOWN OR NOT SPECIFIED';
  18.  
  19. type
  20.   THTMLColor = $80000000..$7FFFFFFF;
  21.  
  22. const
  23.   hcBlack = THTMLColor($000000);
  24.   hcGray = THTMLColor($808080);
  25.   hcLtGray = THTMLColor($C0C0C0);
  26.   hcRed = THTMLColor($FF0000);
  27.   hcGreen = THTMLColor($00FF00);
  28.   hcBlue = THTMLColor($0000FF);
  29.   hcWhite = THTMLColor($FFFFFF);
  30.  
  31. type
  32.   EISAPISockError=   class(Exception);
  33.   EISAPISockTimeOut= class(Exception);
  34.   EISAPIUnknown=     class(Exception);
  35.  
  36. const
  37.   //MAXLINELENGTH=256;
  38.   ESCAPESTRING='~!@#$%^&*()_+|\=-}{]["'':;?/>.<,`';
  39.  
  40. type
  41.   TISAPISock=class
  42.     public
  43.       // ISAPI Exit status and codes
  44.       //ISAPIExitStatus: String;
  45.       //ISAPIExitCode:   Integer;
  46.  
  47.       constructor Create(var ecb: TEXTENSION_CONTROL_BLOCK);
  48.       destructor  Destroy; override;
  49.  
  50.       // Socket block access functions
  51.       procedure Send(buf: PChar; len: DWORD);
  52.       function  Recv(buf: PChar; len: DWORD): DWORD;
  53.  
  54.       // Escape encode/decode
  55.       function  EscapeEncode(s: String): String;
  56.       function  EscapeDecode(s: String): String;
  57.  
  58.       // Query
  59.       function  GetQueryVal(keyName: String): String;
  60.  
  61.       // Form Vars
  62.       function  GetFormVal(keyName: String): String;
  63.  
  64.       // Cookie
  65.       function  GetCookieVal(keyName: String): String;
  66.       procedure SetCookie(keyName, keyVal: String; daysToExpire: Integer);
  67.       procedure ClearCookie(keyName: String);
  68.  
  69.       // Socket text/line access functions
  70.       procedure Write(s: String);
  71.       procedure Writeln(s: String);
  72.       //function  Readln: String;
  73.       //function  Peekln: String;
  74.  
  75.       // Socket control
  76.       procedure SetTimeOut(tMS: DWORD);
  77.       function  GetTimeOut: DWORD;
  78.  
  79.       // ISAPI Server Variables
  80.       function  GetServerVariable(varName: String): String;
  81.       function  GetServerVariableEX(varName: String): String;
  82.  
  83.       // HTML Stuff
  84.       procedure HHeader(title: String; backColor, textColor, linkColor: THTMLColor);
  85.       procedure HPageStart;
  86.       procedure HPageEnd;
  87.       procedure HFormStart(method, executable: String);
  88.       procedure HFormEnd(submitButtonName, resetButtonName: String);
  89.  
  90.       // Line types
  91.       procedure HImage(s: String);
  92.       procedure HHeading(size: Integer; s: String);
  93.       procedure HLine(s: String);
  94.       procedure HBullet(s: String);
  95.       procedure HSeparator;
  96.  
  97.       // Formatting
  98.       function  HBold(s: String): String;
  99.       function  HItalic(s: String): String;
  100.       function  HRef(ref, text: String): String;
  101.       function  HFontSize(s: String; size: Integer): String;
  102.       function  HCenter(s: String): String;
  103.  
  104.       // Form Controls
  105.       procedure HEditBox(caption, fName, defaultText: String; size, maxlength: Integer);
  106.       procedure HRadioBtn(caption: String; const text: array of String; fName: String; const fValue: array of String; default: String );
  107.       procedure HCheckBox(caption: String; const text: array of String; fName: String; const fValue: array of String; default: array of String);
  108.       procedure HListBox(caption: String; const text: array of String; fName: String);
  109.  
  110.     private
  111.       ExtContBlock: TEXTENSION_CONTROL_BLOCK;
  112.       TimeOut:    DWORD;
  113.       Term:       String;
  114.       ConnID:     HCONN;
  115.       FNRead:     TReadClientProc;
  116.       FNWrite:    TWriteClientProc;
  117.       FNServerSupport:     TServerSupportFunctionProc;
  118.       FNGetServerVariable: TGetServerVariableProc;
  119.   end;
  120.  
  121.  
  122.  
  123.  
  124. implementation
  125.  
  126.  
  127.  
  128. end.
  129.